package com.zhoukx.prototype.deepclone;

/**
 * @ClassName Client
 * @Description:深拷贝 原型模式
 * @Author zhoukx
 * @Date 2020/8/6
 **/
public class Client {

    public static void main(String[] args) throws CloneNotSupportedException {
        DeepProtoType deepProtoType = new DeepProtoType();
        deepProtoType.name ="宋江";
        deepProtoType.deepCloneableTarget = new DeepCloneableTarget("周凯旋","送交deepProtoType");
        System.out.println(deepProtoType);
        // 方式一  clone 的方式克隆
//        DeepProtoType clone = (DeepProtoType)deepProtoType.clone();
//        System.out.println(clone);

        // 方式二   使用流的方式克隆
        DeepProtoType deepProtoType1 = (DeepProtoType)deepProtoType.deepClone();
        System.out.println(deepProtoType1);


    }
}
